<!-- START FORM -->
<?php echo form_open_multipart('admin/system/user/save'); ?>
<?php echo fx_control::newInstance('formKey')->createType('hidden')->setData('value', random_string('unique', 16))->render(); ?>
<?php echo fx_control::newInstance('id')->createType('hidden')->binding($model, 'id')->render(); ?>
<div class="formContainer autoCenter autoHeight">
	<!-- HEADER FORM -->
	<div class="formHeader">
		<table class="fullWidth">
			<tr>
				<td class="column50">
					<h3 class="moduleHeader">
						<?php if (!$model->isLoaded()) :?>
							Edit New User
						<?php else :?>
							Edit User <?php echo $model->getUsername(); ?>
						<?php endif; ?>
					</h3>
				</td>
				<td class="column50 rightAlign">
					<button type="button" onclick="window.location='<?php echo site_url("admin/system/user/index", true)?>'">
						<span>Back</span>
					</button>
					<button type="submit">
						<span>Save</span>
					</button>
					<?php if ($model->isLoaded()) :?>
					<button type="button" onclick="window.location='<?php echo site_url("admin/system/user/delete/", true)?>'">
						<span>Delete</span>
					</button>
					<?php endif; ?>
					<button type="reset" onclick="window.location='<?php echo site_url("admin/system/user/edit", true)?>'">
						<span>Reset</span>
					</button>
				</td>
			</tr>
		</table>
	</div>
	<!-- TAB SECTION -->
	<div class="block">
		<h3 class="titleBlock">General Information</h3>
		<div class="contentBlock autoHeight">
			<?php echo fx_control::newInstance('user[entity_type_id]')
											 ->createType('hidden')
											 ->setData('value', '1')
											 ->render(); 
			?>
			<table class="fieldSet fullWidth">
				<tr>
					<td class="fieldLabel">Role</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user[role_id]')
											 ->createType('combobox')
											 ->addOption('--- Select Role ---', 0)
											 ->binding($model, 'role_id', $roles, 'id/name')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Avatar</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user_avatar')
											 ->createType('file')
											 ->binding($model, 'avatar')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Username</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user[username]')
											 ->createType('text')
											 ->binding($model, 'username')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Password</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user[password]')
											 ->createType('password')
											 ->binding($model, 'password')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">First Name</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user[first_name]')
											 ->createType('text')
											 ->binding($model, 'first_name')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Last Name</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user[last_name]')
											 ->createType('text')
											 ->binding($model, 'last_name')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Email</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user[email]')
											 ->createType('text')
											 ->binding($model, 'email')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Phone</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user[phone]')
											 ->createType('text')
											 ->binding($model, 'phone')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Active</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('is_active')
											 ->createType('option')
											 ->addOption('Select Status', '')
											 ->addOption('Active', 1)
											 ->addOption('DeActive', 0)
											 ->binding($model, 'is_active')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Locked</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('locked')
											 ->createType('option')
											 ->addOption('Set Locked', '')
											 ->addOption('Yes', 1)
											 ->addOption('No', 0)
											 ->binding($model, 'locked')
											 ->render(); 
						?>
					</td>
				</tr>
				<tr>
					<td class="fieldLabel">Unlock Day</td>
					<td class="fieldInput">
						<?php echo fx_control::newInstance('user[unlock_day]')
											 ->createType('text')
											 ->binding($model, 'unlock_day')
											 ->render(); 
						?>
					</td>
				</tr>
			</table>
		</div>	
	</div>
</div>
<?php echo form_close(); ?>
